package com.autonavi.yunda.yunji.core.utils;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.OutputStream;

/**
 * protobuf output
 */
public class ProtobufUtil {

    public static void write(HttpServletResponse response, byte[] data) {
        response.setContentType("application/x-protobuf");
        try (OutputStream out = response.getOutputStream()) {
            out.write(data == null ? new byte[0] : data);
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
}
